
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Radash is a utility library for JavaScript and TypeScript that provides a collection of functions for common programming tasks. It aims to be a modern alternative to lodash, offering a more streamlined and type-safe experience.
Array Utilities
The `chunk` function splits an array into smaller arrays of a specified size. This is useful for processing large arrays in smaller, more manageable pieces.
const { chunk } = require('radash');
const array = [1, 2, 3, 4, 5, 6, 7, 8];
const chunkedArray = chunk(array, 3);
console.log(chunkedArray); // [[1, 2, 3], [4, 5, 6], [7, 8]]
Object Utilities
The `pick` function creates a new object composed of the specified properties from the original object. This is useful for selecting only the necessary data from an object.
const { pick } = require('radash');
const obj = { a: 1, b: 2, c: 3 };
const picked = pick(obj, ['a', 'c']);
console.log(picked); // { a: 1, c: 3 }
String Utilities
The `camelCase` function converts a string to camel case. This is useful for formatting strings to a common naming convention.
const { camelCase } = require('radash');
const str = 'hello world';
const camelCasedStr = camelCase(str);
console.log(camelCasedStr); // 'helloWorld'
Function Utilities
The `debounce` function delays the execution of a function until after a specified wait time has elapsed since the last time it was invoked. This is useful for limiting the rate at which a function can be executed.
const { debounce } = require('radash');
const log = () => console.log('Debounced!');
const debouncedLog = debounce(log, 2000);
debouncedLog();
debouncedLog();
debouncedLog(); // 'Debounced!' will be logged only once after 2 seconds
Lodash is a widely-used utility library that provides a broad range of functions for manipulating arrays, objects, strings, and more. It is known for its performance and ease of use. Compared to Radash, Lodash has a larger community and more extensive documentation, but Radash aims to offer a more modern and type-safe alternative.
Underscore is another utility library that offers functional programming helpers without extending any built-in objects. It provides similar functionalities to Radash but is considered less modern and lacks some of the type safety features that Radash offers.
Ramda is a functional programming library for JavaScript that emphasizes immutability and side-effect-free functions. It provides utilities for working with arrays, objects, and other data types in a functional style. While Radash focuses on being a modern utility library, Ramda is more specialized in functional programming paradigms.
:loud_sound: /raw-dash/
yarn add radash
A very brief kitchen sink. See the full documentation here.
import * as _ from 'radash'
const gods = [{
name: 'Ra',
power: 'sun',
rank: 100,
culture: 'egypt'
}, {
name: 'Loki',
power: 'tricks',
rank: 72,
culture: 'norse'
}, {
name: 'Zeus',
power: 'lightning',
rank: 96,
culture: 'greek'
}]
_.max(gods, g => g.rank) // => ra
_.sum(gods, g => g.rank) // => 268
_.fork(gods, g => g.culture === 'norse') // => [[loki], [ra, zeus]]
_.sort(gods, g => g.rank) // => [ra, zeus, loki]
_.boil(gods, (a, b) => a.rank > b.rank ? a : b) // => ra
_.objectify(
gods,
g => g.name.toLowerCase(),
g => _.pick(g, ['power', 'rank', 'culture'])
) // => { ra, zeus, loki }
const godName = _.get(gods, g => g[0].name)
const [err, god] = await _.try(api.gods.findByName)(godName)
const allGods = await _.map(gods, async ({ name }) => {
return api.gods.findByName(name)
})
Contributions are welcome and appreciated! Check out the contributing guide before you dive in.
FAQs
Functional utility library - modern, simple, typed, powerful
The npm package radash receives a total of 255,186 weekly downloads. As such, radash popularity was classified as popular.
We found that radash demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.